import { defHttp } from '@/utils/http/axios';

enum Api {
  //user
  UserStatus = '/basic-api/v2/admin/user/status',
  UserPassword = '/basic-api/v2/admin/user/password',

  //会员
  MemberPage = '/basic-api/v1/admin/member/page',
  MemberAdd = '/basic-api/v1/admin/member/addUpdate',
  MemberAccountPage = '/mock-api/v1/member/account/page',

  // 会员级别
  MemberGroupPage = '/basic-api/v1/admin/member/group/page',
  MemberGroupList = '/basic-api/v1/admin/member/group/list',
  MemberGroupAdd = '/basic-api/v1/admin/member/group/add',

  // 会员积分
  MemberPointPage = '/basic-api/v1/admin/member/point/page',
  MemberPointAdd = '/basic-api/v1/admin/member/point/add',

  //商品折扣
  MemberGroupDiscountPage = '/basic-api/v1/admin/member/groupDiscount/page',
  MemberGroupDiscountAdd = '/basic-api/v1/admin/member/groupDiscount/add',
  MemberGroupDiscountDelete = '/basic-api/v1/admin/member/groupDiscount/delete',
}

//user
export const doUserStatusUpdate = (params?: any) =>
  defHttp.post<any>({ url: Api.UserStatus, params }, { isTransformResponse: false });
export const doUserPasswordUpdate = (params?: any) =>
  defHttp.post<any>({ url: Api.UserPassword, params }, { isTransformResponse: false });

// 会员列表
export const getMemberPage = (params?: any) =>
  defHttp.post<any>({ url: Api.MemberPage, params }, { isTransformResponse: true });
export const doMemberAdd = (params?: any) =>
  defHttp.post<any>({ url: Api.MemberAdd, params }, { isTransformResponse: false });

export const getMemberAccountPage = (params?: any) =>
  defHttp.post<any>({ url: Api.MemberAccountPage, params }, { isTransformResponse: true });
// 会员级别
export const getMemberGroupPage = (params?: any) =>
  defHttp.post<any>({ url: Api.MemberGroupPage, params }, { isTransformResponse: true });
export const getMemberGroupList = (params?: any) =>
  defHttp.post<any>({ url: Api.MemberGroupList, params }, { isTransformResponse: true });
export const doMemberGroupAdd = (params?: any) =>
  defHttp.post<any>({ url: Api.MemberGroupAdd, params }, { isTransformResponse: false });

//会员积分
export const getPointPage = (params?: any) =>
  defHttp.post<any>({ url: Api.MemberPointPage, params }, { isTransformResponse: true });
export const doPointAdd = (params?: any) =>
  defHttp.post<any>({ url: Api.MemberPointAdd, params }, { isTransformResponse: false });

//商品折扣
export const getMemberGroupDiscountPage = (params?: any) =>
  defHttp.post<any>({ url: Api.MemberGroupDiscountPage, params }, { isTransformResponse: true });
export const doMemberGroupDiscountAdd = (params?: any) =>
  defHttp.post<any>({ url: Api.MemberGroupDiscountAdd, params }, { isTransformResponse: false });
export const doMemberGroupDiscountDelete = (params?: any) =>
  defHttp.post<any>({ url: Api.MemberGroupDiscountDelete, params }, { isTransformResponse: false });
